import { param2Obj } from '@/utils';

// 状态列表
const statusList = {
  procurementplan: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '已打回', value: '2' },
    { name: '待执行', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已生成', value: '5' }
  ],
  procurementorder: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '已打回', value: '2' },
    { name: '待执行', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已生成', value: '5' }
  ],
  inbound: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '待采购', value: '2' },
    { name: '已同意', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已入库', value: '5' }
  ],
  outbound: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '待采购', value: '2' },
    { name: '已同意', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已出库', value: '5' }
  ],
  checkout: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '待采购', value: '2' },
    { name: '已同意', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已盘点', value: '5' }
  ],
  transfer: [
    { name: '待提交', value: '0' },
    { name: '待审批', value: '1' },
    { name: '待采购', value: '2' },
    { name: '已同意', value: '3' },
    { name: '已拒绝', value: '4' },
    { name: '已调拨', value: '5' }
  ],
  assemdisassembly: [
    { name: '待提交', value: 0 },
    { name: '待审批', value: 1 },
    { name: '待采购', value: 2 },
    { name: '已同意', value: 3 },
    { name: '已拒绝', value: 4 },
    { name: '已入库', value: 5 }
  ],
  storehouse: [
    { name: '可用', value: 0 },
    { name: '不可用', value: 1 },
    { name: '锁定', value: 2 }
  ],
  approve: [
    { name: '待审批', value: '0' },
    { name: '部分同意', value: '1' },
    { name: '已同意', value: '2' },
    { name: '已拒绝', value: '3' },
    { name: '已打回', value: '4' }
  ],
  productneed: [
    { name: '待提交', value: '0' },
    { name: '待评审', value: '1' },
    { name: '待发布', value: '2' },
    { name: '待实现', value: '3' },
    { name: '待验证', value: '4' },
    { name: '待确认', value: '5' },
    { name: '已完成', value: '6' },
    { name: '已拒绝', value: '7' },
    { name: '验证失败', value: '8' },
    { name: '确认失败', value: '9' }
  ]
};
// 类别列表
const typesList = {
  inbound: [
    { name: '外购入库', value: '0' },
    { name: '委外入库', value: '1' },
    { name: '生产产品入库', value: '2' },
    { name: '生产退料入库', value: '3' },
    { name: '销售退货入库', value: '4' },
    { name: '其他入库', value: '5' }
  ],
  outbound: [
    { name: '生产领料出库', value: '0' },
    { name: '生产补料出库', value: '1' },
    { name: '外购退料出库', value: '2' },
    { name: '委外出库', value: '3' },
    { name: '销售出货', value: '4' },
    { name: '其他出库', value: '5' }
  ],
  checkout: [
    { name: '定期盘点', value: '0' },
    { name: '循环盘点', value: '1' },
    { name: '临时盘点', value: '2' }
  ],
  assemdisassembly: [
    { name: '组装', value: '0' },
    { name: '拆卸', value: '1' }
  ],
  // 委外类型
  entrust: [
    { name: '灭菌', value: '0' },
    { name: '加工', value: '1' },
    { name: '其他', value: '2' }
  ],
  // 退料类型
  return: [
    { name: '类型A', value: '0' },
    { name: '类型B', value: '1' },
    { name: '类型C', value: '2' }
  ],
  // 客户类型
  customer: [
    { name: '北京客户', value: '0' },
    { name: '上海客户', value: '1' },
    { name: '深圳客户', value: '2' },
    { name: '广州客户', value: '3' }
  ],
  storehouse: [
    { name: '研发库', value: 0 },
    { name: '生产库', value: 1 },
    { name: '成品库', value: 2 },
    { name: '原料库', value: 3 },
    { name: '其他', value: 4 }
  ],
  approve: [
    { name: '采购订单审批', value: '0' },
    { name: '入库审批', value: '1' },
    { name: '出库审批', value: '2' },
    { name: '调拨审批', value: '3' }
  ],
  overview: [
    { name: '全部入库', value: '0' },
    { name: '全部出库', value: '1' },
    { name: '外购入库', value: '2' },
    { name: '生产品入库', value: '3' },
    { name: '委外入库', value: '4' },
    { name: '销售退货入库', value: '5' },
    { name: '生产退料入库', value: '6' },
    { name: '盘盈入库', value: '7' },
    { name: '调拨入库', value: '8' },
    { name: '组装拆卸入库', value: '9' },
    { name: '其他入库', value: '10' },
    { name: '生产领料出库', value: '11' },
    { name: '外购退料出库', value: '12' },
    { name: '委外出库', value: '13' },
    { name: '销售出库', value: '14' },
    { name: '盘亏出库', value: '15' },
    { name: '调拨出库', value: '16' },
    { name: '组装拆卸出库', value: '17' },
    { name: '其他出库', value: '18' }
  ]
};
// 仓库列表
const storeList = [
  { name: '仓库一', value: '0' },
  { name: '仓库二', value: '1' },
  { name: '仓库三', value: '2' }
];

// 仓管员列表
const storeKeeperList = [
  { name: '仓管员一', value: '0' },
  { name: '仓管员二', value: '1' },
  { name: '仓管员三', value: '2' }
];

// 新建仓库时仓管员列表
const storeAllKeeperList = [
  { name: '新建仓管员一', value: '0' },
  { name: '新建仓管员二', value: '1' },
  { name: '新建仓管员三', value: '2' }
];

// 一级部门列表
const oneDeptList = [
  { name: '超声部', value: '0' },
  { name: '放射部', value: '1' },
  { name: '混合部', value: '2' },
];

// 二级部门列表
const towDeptList = [
  { name: '超声一部', value: '0' },
  { name: '超声二部', value: '1' },
  { name: '超声三部', value: '2' },
];

// 员工列表
const employeeList = [
  { name: '小明', value: '0' },
  { name: '小王', value: '1' },
  { name: '小丽', value: '2' }
];

// 供应商列表
const supplyList = [
  { name: '供应商A', value: '0' },
  { name: '供应商B', value: '1' },
  { name: '供应商C', value: '2' }
];

// 联系人列表
const contactList = [
  { name: '联系人一', value: '15221977774' },
  { name: '联系人二', value: '13622334455' },
  { name: '联系人三', value: '18812345678' }
];

// 物料列表
const materialList = [
  { name: '物料A', value: '0' },
  { name: '物料B', value: '1' },
  { name: '物料C', value: '2' }
];

const storageSiteList = [
  { name: '仓位A', value: '0' },
  { name: '仓位B', value: '1' },
  { name: '仓位C', value: '2' }
];

// 物料列表
const basicConfig = {
  // 物料类别
  skuTypes: [
    { name: '成品', value: '0' },
    { name: '半成品', value: '1' },
    { name: '原材料', value: '2' },
    { name: '辅料', value: '3' },
    { name: '在产品', value: '4' },
    { name: '工具', value: '5' },
    { name: '设备', value: '6' },
    { name: '消耗品', value: '7' },
    { name: '费用', value: '8' },
    { name: '服务', value: '9' },
    { name: '文件', value: '10' },
    { name: '资产', value: '11' }
  ],
  // 物料属性
  skuPropertys: [
    { name: '外购', value: '0' },
    { name: '自制', value: '1' },
    { name: '委外', value: '2' },
    { name: '虚拟', value: '3' }
  ],
  // 物料分级
  skuLevels: [
    { name: 'A', value: '0' },
    { name: 'B', value: '1' },
    { name: 'C', value: '2' }
  ],
  // 基本单位
  basicUnits: [
    { name: '只', value: '0' },
    { name: '盒', value: '1' },
    { name: '箱', value: '2' }
  ],
  // 制造商
  manufacturers: [
    { name: '制造商A', value: '0' },
    { name: '制造商B', value: '1' },
    { name: '制造商C', value: '2' }
  ],
  // 币种
  currency: [
    { name: '人民币', value: '0' },
    { name: '美元', value: '1' },
    { name: '欧元', value: '2' }
  ],
  // 发料方式
  allowingOverissuance: [
    { name: '允许超发', value: '0' },
    { name: '不许超发', value: '1' }
  ]
};
// 供应商列表
const vendorConfig = {
  // 国家
  countrys: [
    { name: '中国', value: 'ZG' },
    { name: '美国', value: 'MG' },
    { name: '日本', value: 'RB' },
  ],
  // 城市
  citys: [
    { name: '黄山', value: 'ZG-HS' },
    { name: '上海', value: 'ZG-SH' },
    { name: '拉萨', value: 'ZG-LS' }
  ],
  // 行业
  industrys: [
    { name: '服装', value: 'FZ' },
    { name: '冶金', value: 'YJ' }
  ],
  // 类别
  vendorCategory: [
    { name: '委外', value: '0' },
    { name: '采购', value: '1' },
    { name: '服务', value: '2' },
    { name: '综合', value: '3' }
  ],
  // 分级
  vendorGrade: [
    { name: '分级一', value: '0' },
    { name: '分级二', value: '1' },
    { name: '分级三', value: '2' }
  ],
  // 性质
  characters: [
    { name: '外资', value: '0' },
    { name: '国有', value: '1' },
    { name: '私有', value: '2' },
    { name: '中外合资', value: '3' }
  ],
  // 规模
  scales: [
    { name: 'A', value: '0' },
    { name: 'B', value: '1' },
    { name: 'C', value: '2' }
  ],
  // 职务
  positions: [
    { name: '经理', value: 'JL' },
    { name: '职工', value: 'ZG' },
    { name: '采购', value: 'CG' }
  ],
  // 结算币种
  currencys: [
    { name: '人民币', value: '0' },
    { name: '美元', value: '1' },
    { name: '日元', value: '2' }
  ],
  // 结算方式
  settlements: [
    { name: '支票', value: '0' },
    { name: '电汇', value: '1' },
    { name: '银行', value: '2' }
  ],
  // 付款条件
  paymentTerms: [
    { name: '付款条件一', value: '0' },
    { name: '付款条件二', value: '1' },
    { name: '付款条件三', value: '2' }
  ],
  // 发票类型
  invoiceTypes: [
    { name: '委外', value: '0' },
    { name: '采购', value: '1' },
    { name: '服务', value: '2' },
    { name: '综合', value: '3' }
  ],
  // 默认税率
  defaultTaxRates: [
    { name: 'A', value: '0' },
    { name: 'B', value: '1' },
    { name: 'C', value: '2' },
  ]
};

// 路由列表
const routeList = {
  home: [
    { name: 'mission', value: '任务', roles: ['00001'] },
    { name: 'product', value: '产品' },
    { name: 'purchase', value: '采购', roles: ['00001', '00002'] },
    { name: 'inventory', value: '库存', roles: ['00001', '00002'] },
    { name: 'train', value: '培训', roles: ['00001', '00002'] },
    { name: 'manage', value: '管理', roles: ['00001'] },
    { name: 'config', value: '配置', roles: ['00002'] }
  ],
  manage: [
    { name: 'staff', value: '员工管理' },
    { name: 'role', value: '角色管理' },
    { name: 'approve', value: '审批管理', roles: ['00001'] },
    { name: 'materiel', value: '物料管理' },
    { name: 'store', value: '仓库管理' },
    { name: 'provider', value: '供应商管理', roles: ['00004'] },
    { name: 'invoice', value: '发票管理' },
    { name: 'credential', value: '证书管理' }
  ],
  product: [
    { name: 'need', value: '需求' },
    { name: 'test', value: '测试' },
    { name: 'defect', value: '缺陷' },
    { name: 'risk', value: '风险' }
  ],
  train: [
    { name: 'course', value: '待学课程' },
    { name: 'task', value: '授课任务' },
    { name: 'assign', value: '指派' },
    { name: 'record', value: '培训记录' },
    { name: 'lessons', value: '课程库' },
    { name: 'library', value: '资料库' },
    { name: 'report', value: '培训报表' }
  ],
  config: [
    { name: 'data', value: '数据配置' },
    { name: 'code', value: '编码配置' }
  ],
  inventory: [
    { name: 'overview', value: '库存一览' },
    { name: 'inbound', value: '入库' },
    { name: 'outbound', value: '出库' },
    { name: 'checkout', value: '盘点', roles: ['00003'] },
    { name: 'allot', value: '调拨' },
    { name: 'assembly', value: '组装拆卸' },
    { name: 'quantity', value: '数量预警' },
    { name: 'validity', value: '有效期预警' }
  ],
  mission: [
    { name: 'approve', value: '审批任务' }
  ],
  purchase: [
    { name: 'plan', value: '采购申请' },
    { name: 'order', value: '采购订单' },
    { name: 'price', value: '单价维护' }
  ]
};

export default {
  login: () => ({
    accessToken: {
      token: 'access-token',
      expires: 3600
    },
    clientId: 'clientId',
    refreshToken: {
      token: 'refresh-token',
      expires: 3600
    }
  }),
  getUserInfo: () => ({
    status: 0,
    obj: {
      name: '管理员',
      employeeId: '000012',
      roles: ['00001', '00002']
    }
  }),
  getStatus: (config) => {
    const orderType = param2Obj(config.url).orderType;
    return statusList[orderType] || [];
  },
  getTypes: (config) => {
    const orderType = param2Obj(config.url).orderType;
    return typesList[orderType] || [];
  },
  getRoutes: (config) => {
    const routeType = param2Obj(config.url).name;
    return {
      status: 0,
      obj: routeList[routeType || 'home'] || [],
      comment: '成功'
    };
  },
  getStores: () => storeList,
  getStoreKeepers: () => storeKeeperList,
  getStoreAllKeepers: () => storeAllKeeperList,
  getOneLevelDept: () => oneDeptList,
  getTwoLevelDept: () => towDeptList,
  getEmployees: () => employeeList,
  getSupplys: () => supplyList,
  getContacts: () => contactList,
  getMaterials: () => materialList,
  getStorageSite: () => storageSiteList,
  getBasicConfigs: () => basicConfig,
  getVendorConfigs: () => vendorConfig
};
